<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>控制面板</title>
    <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">
    <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/webapp/js/common/jquery.global.settings.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/webapp/js/common/config.js"></script>


</head>
<body>
     <div class="easyui-container-fluid">
         <div class="easyui-panel" style="border:none;">
             <div class="nav" id="nav"></div>
             <div class="easyui-panel" style="border:none;">
                 <form id="ff">
                     <div style="margin-bottom:20px;">
                     	<span>
                         <label class="item-label">操作人：</label>
                         <input type="text" class="easyui-combobox" name="userName" id="user" style="width:100px;"/>
                     	</span>
                         <label class="item-label">报告年份：</label>
                         <input type="text" id="year" name="year" class="easyui-combobox" style="width: 100px;"/>
                         <span id="monthLabel">
	                        <label class="item-label">报告月份：</label>
	                        <input id="month" name="month" type="text" class="easyui-combobox" style="width: 100px;" />
                        </span>
                         <span id="weekLabel">
                            <label class="item-label">报告周：</label>
                        	<input type="text" id="week" name="week" class="easyui-combobox" style="width: 100px;"/>
                        </span>
                         <label class="item-label">品类：</label>
                         <select id="categorySelect" name="categoryCode" class="easyui-combobox" style="width:100px;">
                         </select>
                         <label class="item-label">排序方式：</label>
		                <select  name="sortType" class="easyui-combobox" id="sortType" data-options="panelHeight:'92'" style="width:160px;"  >
		                	<option value="NO">无</option>
		                	<option value="CODING">处理空型号总数</option>
		                	<option value="ADDMODEL">添加新型号总数</option>
		                </select>
		                <a href="javascript:void(0);" style="margin-left:40px;width:80px;" class="easyui-linkbutton c8" onclick="searchBy()">查询</a>
                     </div>
                     <!-- 
                     <div style="margin-bottom:20px;">
                     	<label class="item-label">省份：</label>
                        <select class="easyui-combobox" id="provinceSelect" name="provinceCode" style="width:100px;"></select>
                        <label class="item-label">市：</label>
                        <select class="easyui-combobox" id="citySelect" name="cityCode" style="width:100px;"></select>
                     	<a href="javascript:void(0);" style="margin-left:40px;width:80px;" class="easyui-linkbutton c8" onclick="searchBy()">查询</a>
                     </div>
                      -->
                     <div style="margin-bottom:10px;margin-left: 10px;text-align:left;">
                     	<span id="totalInfo" style="margin-right:10px;font-weight: bold;font-size: 16px;"></span>
                     </div>
                 </form>
             </div>
             <div class="table-wrapper">
                 <table id="datagrid" class="easyui-datagrid" data-options="fitColumns:true,scrollbarSize:0">
                     <thead>
                        <tr>
                            <th data-options="field:'username',align:'center'" width="120" >操作人</th>
                            <th data-options="field:'analyzeModeCount',align:'center'" width="120">编码总量</th>
                            <th data-options="field:'modelCount',align:'center'" width="100" >型号总量</th>
                            <th data-options="field:'lastLoginTime',formatter:timeFormatter,align:'center'" width="100" >最近登录时间</th>
                            <th data-options="field:'department',align:'center'" width="100" >部门</th>
                        </tr>
                     </thead>
                 </table>
             </div>
         </div>
     </div>
     <script type="text/javascript">
         $(function(){
             setNav();
             initUserSelect("user");
             initMonthWeek("monthLabel","weekLabel");
             initCategorySelectnew("categorySelect");
             $("#datagrid").datagrid({
                 // pagination:true,
                 rownumbers:true
             });
             aRecords("监测","/webapp/pages/product/audit/usermonitor")
         });

         function searchBy(){
        	 /*if(!$('#end').datebox('getValue')){
        		 alert('请选择结束时间');
        		 return;
        	 } if(!$('#start').datebox('getValue')){
        		 alert('请选择开始时间');
        		 return;
        	 }*/

             var param = getFormData(document.getElementById("ff"));
             param.reportType=window.parent.workMode.toUpperCase();
             // console.log(param);
             $.ajax({
                  url:config.url + "/user/monitor",
                 type:"get",
                 data:transfer(param),
                 dataType:'json',
                  xhrFields:{withCredentials:true},
                  beforeSend:function () {
                      $.messager.progress({
                          title:"请稍等",
                          interval:50,
                          text:"数据加载中..."
                      });
                    },
                 complete:function () {
                     $.messager.progress("close");
                 },
                 success:function(data){
                     $.messager.progress("close");
                     if(data){
                         $("#datagrid").datagrid("loadData",data);
                     }
                 },
                  error:function(data){
                     // console.log(data);
                     $.messager.progress("close");
                  }
              });
          }
         function myformatter(date) {
             var y = date.getFullYear();
             var m = date.getMonth() + 1;
             var d = date.getDate();
             return y + '-' + (m < 10 ? ('0' + m) : m) + '-'
                 + (d < 10 ? ('0' + d) : d);
         }
         function myparser(s) {
             if (!s)
                 return new Date();
             var ss = (s.split('-'));
             var y = parseInt(ss[0], 10);
             var m = parseInt(ss[1], 10);
             var d = parseInt(ss[2], 10);
             if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
                 return new Date(y, m - 1, d);
             } else {
                 return new Date();
             }
         }

     </script>
</body>
</html>